import httpRequest from '@/utils/httpRequest'


export function userInfo (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/user/info'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function getUserList (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/user/list'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function deleteUser (data, openDefultdata = true) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/user/delete'),
    method: 'post',
    data: httpRequest.adornData(data, openDefultdata)
  })
}

export function userInfoById (id) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/user/info/${id}`),
    method: 'get',
    params: httpRequest.adornParams()
  })
}

export function userInfoSave (data) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/user/${!data.userId ? 'save' : 'update'}`),
    method: 'post',
    data: httpRequest.adornData(data)
  })
}
